﻿using System.Linq;
using AB.ServiceDirectory.Commons.DataFilters;
using AB.ServiceDirectory.Dao;
using AB.ServiceDirectory.Entities;

namespace AB.ServiceDirectory.BO
{
    public static class AddressBO
    {
        private static readonly AddressLookupDao AddressLookupDao = new AddressLookupDao();

        /// <summary>
        /// Gets the list.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <param name="sortType">Type of the sort.</param>
        /// <param name="startRowIndex">Start index of the row.</param>
        /// <param name="maxRows">The max rows.</param>
        /// <returns></returns>
        public static IQueryable<Address> GetList(AddressFilter filter, string sortType, int startRowIndex, int maxRows)
        {
            var queryable = AddressLookupDao.GetList(filter, sortType, startRowIndex, maxRows);
            return queryable;
        }
        /// <summary>
        /// Gets the list count.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <returns></returns>
        public static int GetListCount(AddressFilter filter)
        {
            var count = AddressLookupDao.GetListCount(filter);
            return count;
        }
        /// <summary>
        /// Gets the address by id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns>Address object</returns>
        public static Address GetAddressById(int id)
        {
            var results = AddressLookupDao.GetAddressById(id);
            return results;
        }
        /// <summary>
        /// Gets the address.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <returns>Address object</returns>
        public static Address GetAddress(AddressFilter filter)
        {
            return AddressLookupDao.GetAddress(filter);
        }
    }
}
